package com.sduept.nwld.dataserver.manager.statistics;

import com.sduept.core.dao.SuperDAO;
import com.sduept.nwld.dataserver.model.countanalyse.ProtectResponseTimeStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ResponseFeaProtectManager {

	@Autowired
	private SuperDAO dao;
	
	
	public List<ProtectResponseTimeStatistics> findAll() {
		return dao.findAll(ProtectResponseTimeStatistics.class);
	}
	
	public ProtectResponseTimeStatistics createOrUpdate(ProtectResponseTimeStatistics bean) {
		return dao.createOrUpdate(bean, ProtectResponseTimeStatistics.class);
	}
	
	public void deleteById(String id) {
		dao.delete(id, ProtectResponseTimeStatistics.class);
	}
	
	public List<?> getRecordsBySql(String sql) {
		return dao.nativeQuery(sql);
	}
	
	public List<ProtectResponseTimeStatistics> findByCondition(Integer year,Integer month, String area) {
		String esql = "from ProtectResponseTimeStatistics where year = '"+year+"' and area = '"+area+"' and month = '"+month+"'";
		List<ProtectResponseTimeStatistics> list = dao.findByComplexCondition(esql, ProtectResponseTimeStatistics.class);
		return list;
	}
	
}
